package me.out1kiss.www.web.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import me.out1kiss.www.request.Request1;
import me.out1kiss.www.response.Response1;
import me.out1kiss.www.web.swagger.Api1Swagger;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @author hx
 */
@Api1Swagger
@Api(tags = "测试API1")
@RestController
@RequestMapping("/api/test1/")
public class Api1Controller {

    @ApiOperation("查询数据")
    @GetMapping("api1")
    public ResponseEntity<String> api1(@RequestParam Integer id) {
        return ResponseEntity.ok("SUCCESS");
    }

    @ApiOperation("数据列表")
    @GetMapping("api2")
    @ApiResponses({
            @ApiResponse(responseCode = "401001", description = "token错误或已失效")
    })
    public ResponseEntity<Response1> api2(Request1 request1) {
        return ResponseEntity.ok(new Response1());
    }

    @ApiOperation("数据新增")
    @PutMapping("api3")
    public ResponseEntity<String> api3(@RequestParam Integer id) {
        return ResponseEntity.ok("SUCCESS");
    }

}
